<HTML>
<HEAD>
  <STYLE type="text/css">
    H1 {color: black }
    H2 {color: maroon }
    H3 {color: #007090 }
    A.head:link {color: #0060a0 }
    A.head:visited {color: #3040c0 }
    A.head:active {color: white }
    A.head:hover {color: yellow }
    A.red:link {color: red }
    A.red:visited {color: maroon }
    A.red:active {color: yellow }
  </STYLE>
</HEAD>
<TITLE>Magic-8.3 Command Reference</TITLE>
<BODY BACKGROUND=graphics/blpaper.gif>
<H1> <IMG SRC=graphics/magic_title8_3.png ALT="Magic VLSI Layout Tool Version 8.3">
     <IMG SRC=graphics/magic_OGL_sm.gif ALIGN="top" ALT="*"> </H1>

<H2>select</H2>
<HR>
Select or unselect portions of the layout according to the options, or
create a new cell definition from a selection.
<HR>

<H3>Shortcuts:</H3>
   <BLOCKQUOTE>
      Key macro <B>,</B> (comma) implements the command <B>select clear</B>. <BR>
      Key macro <B>s</B> implements the command <B>select</B>. <BR>
      Key macro <B>S</B> implements the command <B>select more</B>. <BR>
      Key macro <I>Control-</I><B>S</B> implements the
		command <B>select less</B>. <BR>
      Key macro <B>a</B> implements the command <B>select visible</B>. <BR>
      Key macro <B>A</B> implements the command <B>select more visible</B>. <BR>
      Key macro <I>Control-</I><B>A</B> implements the
		command <B>select less visible</B>. <BR>
      Key macro <B>i</B> implements the command <B>select cell</B>. <BR>
      Key macro <B>I</B> implements the command <B>select more cell</B>. <BR>
      Key macro <I>Control-</I><B>I</B> implements the
		command <B>select less cell</B>.
   </BLOCKQUOTE>

<H3>Usage:</H3>
   <BLOCKQUOTE>
      <B>select</B> <I>option</I> <BR><BR>
      <BLOCKQUOTE>
         where <I>option</I> may be one of the following:
	 <DL>
	   <DT> [<B>more</B> | <B>less</B>] [<I>layers</I>] [<B>at</B> <I>x y</I>]
	   <DD> [De]select material under cursor or indicated position, or
		[de]select a subcell if the cursor or indicated position is over
		space.
	   <DT>	<B>nocycle</B> [<I>layers</I>] [<B>at</B> <I>x y</I>]
	   <DD> Select material without cycling through different tile
	   	types when "select" is called from the same cursor position
		or indicated coordinate more than once.
	   <DT> [<B>do</B> | <B>no</B> | <B>simple</B>] <B>labels</B>
	   <DD> Set policy for copying labels during a network selection.
	   <DT>	[<B>more</B> | <B>less</B>] <B>area</B> [<I>layers</I>] [<I>pattern</I>]
	   <DD> [De]select all material under box in layers <I>layers</I>.
		The optional glob-style matching pattern <I>pattern</I> will
		select or deselect any labels according to the pattern.
	   <DT>	[<B>more</B> | <B>less</B>] <B>visible</B> [<I>layers</I>]
	   <DD> [De]select all visible material under box in layers <I>layers</I>.
	   <DT>	[<B>more</B> | <B>less</B>] <B>box</B> [<I>layers</I>]
	   <DD> [De]select material specified by the boundary of the cursor box
	   <DT>	[<B>more</B> | <B>less</B>] <B>chunk</B> [<I>layers</I>]
	   <DD> [De]select a network chunk (largest rectangle) specified by
		the lower left corner of the cursor box
	   <DT>	[<B>more</B> | <B>less</B>] <B>region</B> [<I>layers</I>]
	   <DD> [De]select a network region specified by
		the lower left corner of the cursor box
	   <DT>	[<B>more</B> | <B>less</B>] <B>net</B> [<I>layers</I>]
	   <DD> [De]select an entire electrical network specified by
		the lower left corner of the cursor box
	   <DT>	[<B>more</B> | <B>less</B>] <B>cell</B> [<I>name</I>]
	   <DD> [De]select the cell under cursor, or the cell use (instance)
		named <I>name</I>.
	   <DT>	<B>top cell</B>
	   <DD> Select the topmost cell in the window, which does not have
		an instance name and therefore cannot be selected with the
		<B>select cell</B> command.
	   <DT>	<B>save</B> <I>cell</I>
	   <DD> Save selection as cell named <I>cell</I>, which is also
		saved to disk as <I>cell</I><TT>.mag</TT>.
	   <DT>	<B>intersect</B> [<B>~</B>]<I>layer</I>
	   <DD> Keep only the selected paint that intersects with <I>layer</I>.
		Used with "<B>~</B>" or "<B>!</B>" in front of the layer, keep
		only the selected paint that does not intersect with <I>layer</I>.
	   <DT>	<B>clear</B>
	   <DD> Clear selection
	   <DT>	<B>pick</B>
	   <DD> Remove the selection from the layout, but retain the
	   	selection buffer for interactive processing.
	   <DT>	<B>flat</B>
	   <DD> Flatten the contents of the selection buffer.
	   <DT>	<B>keep</B>
	   <DD> Copy the selection from the layout into the selection
	   	buffer, and keep the selection buffer for interactive
		processing.
	   <DT>	<B>move</B> [ <I>x y</I> ]
	   <DD> Move the selection buffer to position <I>x y</I>,
	   	relative to the cell definition origin.  If <I>x</I> and
		<I>y</I> are not given, the move the selection buffer so
		that its lower left corner is at the current pointer
		position.
	   <DT> <B>bbox</B>
	   <DD> Return the bounding box of the selection.
	   <DT> <B>feedback</B> [ <I>style</I> [ <I>text</I> ]]
	   <DD> (From Magic version 8.1.35) Copy the selection into a
		feedback area for permanent display (until removed
		using "feedback clear").  The selection will be displayed
		in style "<I>style</I>", which is one of the styles
		defined in the graphics style file (e.g, colors like
		"orange", "white"; layout styles like "pwell"; or
		technical styles like "vert_highlights").  The <I>text</I>
		is attached to the highlight for querying using the
		"feedback why" command.
	   <DT> <B>short</B> <I>label1</I> <I>label2</I>
	   <DD> (From Magic version 8.0.105) Find the path that electrically
		connects (shorts) the nodes labeled "<I>label1</I>" and
		"<I>label2</I>".  Note that this is a simple tile-based search,
		so the highlighted path may show only parts of wires, and may
		extend past points where the path turns, but it will find a
		valid path if one exists.
	   <DT>	<B>help</B>
	   <DD> Print help information
	 </DL>
      </BLOCKQUOTE>
   </BLOCKQUOTE>

<H3>Summary:</H3>
   <BLOCKQUOTE>
      The <B>select</B> command changes what material is in the current
      selection.  <B>magic</B> maintains a separate cell definition
      that represents the current selection.  Without the options
      <B>more</B> or <B>less</B>, the selection is cleared prior to
      executing the new selection command.  Otherwise, <B>more</B>
      adds to the existing selection and <B>less</B> subtracts from
      it. <P>

      Network selection differs from other types of selection in
      that <B>magic</B> uses a sophisticated algorithm to determine
      what is electrically connected together throughout the layout.
      A <B>chunk</B> is the largest rectangle containing a single
      layer type.  A <B>region</B> is the largest network area
      containing a single layer type.  The region stops where the
      net connects to a different layer type.  The <B>net</B> is
      the entire electrical network. <P>

      The <B>select labels</B> option sets the policy for the selection
      of labels when doing a <B>region</B> or <B>network</B> selection.
      The options are <B>select do labels</B>, which is the default
      behavior, <B>select no labels</B>, and <B>select simple labels</B>.
      The default behavior is to copy all labels into the selection,
      but create hierarchical names for any labels found in subcells by
      prepending the subcell instance name in front with a slash ("/")
      character separator, in the same way as hierarchical net names
      are generated in flattened SPICE output.  This allows a network
      selection to be copied without causing name collisions among
      labels in subcells, and is the "safe" option.  However, such labels
      are often long and clutter up the layout.  The <B>no labels</B>
      option selects a network without selecting any labels at all.
      The <B>simple labels</B> selects labels in subcells but does not
      expand them into hierarchical names. <P>

      The <B>select save</B> option differs from the rest in that it
      does not alter the current selection, but creates a new cell
      definition from the current selection.  Note that this cell
      is created as a top-level cell, and does not replace the current
      selection as a use in the edit cell.  To do that requires
      "<B>select save</B> <I>cell</I>" followed by "<B>delete</B>"
      and "<B>getcell child 0 0 parent 0 0</B>".  The last command
      syntax is used because the bounds of the selection may differ
      from the cursor box. <P>

      The <B>select intersect</B> function allows the manipulation of
      the selection using boolean operators that are much like the
      ones used in reading and generating GDS files.  <B>select
      intersect</B> <I>layer</I> computes the value of the selection
      AND <I>layer</I> and replaces the selection with the
      result.  <B>select intersect ~</B><I>layer</I> computes the
      value of the selection AND-NOT <I>layer</I> and replaces the
      selection with the result. <P>

      The <B>select short</B> function finds an electrical connection
      between two labeled points.  It works by starting a "<B>select
      net</B>" net search at the first label, continuing until it
      reaches the second label, and then pruning back any branches of
      the search not directly connecting the two points.  <P>

      The <B>select bbox</B> function is useful when some command
      that only operates on the contents of the cursor box needs to
      be applied to the area of a selection.  It returns the coordinates
      of the bounding box of the selection.  The cursor can be set to
      this using the Tcl command <B>box values {*}[select bbox]</B>.
      <B>select bbox</B> returns values in internal coordinates, so be
      sure to set the snap spacing to <B>snap internal</B> before doing
      this. <P>

      The remaining options such as <B>pick</B>, <B>clear</B>, and
      <B>flat</B> all operate on the selection buffer without
      clearing the contents of the buffer.  They are used primarily
      by the "pick tool" for interactive copy and paste functions. 
      The following command sequence creates a new cell from the
      selection and replaces the selected material with the new
      cell:

      <BLOCKQUOTE>
 	 <B>select pick</B> <BR>
 	 <B>select save</B> <I>cellname</I> <BR>
 	 <B>getcell</B> <I>cellname</I>
      </BLOCKQUOTE>

      The following sequence flattens cells within a layout.  This
      differs from both the "<B>flatten</B>" and "<B>dump</B>" commands
      by being able to flatten a group of cell uses, and being able
      to directly replace the existing cell with the flattened paint.
      In effect, it is the reverse of the operation above.

      <BLOCKQUOTE>
	 <B>select pick</B> <BR>
	 <B>select flat</B> <BR>
	 <B>select keep</B>
      </BLOCKQUOTE>

   </BLOCKQUOTE>

<H3>Implementation Notes:</H3>
   <BLOCKQUOTE>
      <B>select</B> is implemented as a built-in command in <B>magic</B>.
      The <B>select keep</B>, <B>select move</B>, and <B>select pick</B>
      are interactive functions used by the "pick" tool.
   </BLOCKQUOTE>

<H3>See Also:</H3>
   <BLOCKQUOTE>
      <A HREF=flatten.html><B>flatten</B></A> <BR>
      <A HREF=dump.html><B>dump</B></A> <BR>
      <A HREF=changetool.html><B>tool</B> (Tcl script version)</A>
   </BLOCKQUOTE>

<H3>Bugs:</H3>
   <BLOCKQUOTE>
      To be consistent, <B>select save</B> should be a separate command,
      since like other commands it operates on the selection rather than
      alter what is in the selection.
   </BLOCKQUOTE>

<P><IMG SRC=graphics/line1.gif><P>
<TABLE BORDER=0>
  <TR>
    <TD> <A HREF=commands.html>Return to command index</A>
  </TR>
</TABLE>
<P><I>Last updated:</I> October 9, 2021 at 1:59pm <P>
</BODY>
</HTML>
